package shujia.day16.singleMode;

/*
    懒汉式写法
 */
public class Student2 {
    private static Student2 student2;

    private Student2() {

    }

    public synchronized static Student2 getStudent2() {
        if (student2 == null) {
            // t1, t2, t3
            student2 = new Student2();
            return student2;
        }else {
            return student2;
        }
    }
}
